package main

import (
	"bufio"
	"log"
	"os"
	"time"

	"http_device/server"
	"http_device/server/test_device"
	"http_device/server/test_tcp_client"
)

func init() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)
}

func main() {
	go func() {
		s := server.NewServer()
		s.Serve()
	}()

	time.Sleep(time.Second)

	go func() {
		test_device.DemoDevice()
	}()

	time.Sleep(time.Second)

	log.Println("回车: 发起对设备的TCP连接")
	_, _, _ = bufio.NewReader(os.Stdin).ReadLine()

	go test_tcp_client.TcpClient("tony")
	go test_tcp_client.TcpClient("tina")

	select {}
}
